<?php
//
session_start();
//项目名称 
define('PROJECTNAME', 'myweb');
//网站全路径
define('ROOT', $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR);

//初始化
require ROOT.'program/init.php';

$request_c = $_REQUEST['c'];
$request_a = $_REQUEST['a'];

if(!empty ($request_c))
{
    if(empty ($request_a)){
        $temp = new mydefault;
        $temp->defaultfunc();
        //exit("$request_a is not find..");
    }
}else{
    $request_c = "default";
}

if(empty ($request_a)){
    $request_a = "index";
}

//如果模块和控制器都为空则，调用默认设置的方法
if($request_c == "default"){
    $mydefault = new mydefault();
    if (method_exists($mydefault, $request_a)) {
        call_user_func(array($mydefault,$request_a));
    }else{
        $mydefault->defaultfunc();
        exit("function is not find!");
    }
}else{
    if(class_exists($request_c)){
        $tempclass = new $request_c;
        if(method_exists($tempclass, $request_a)){
            call_user_func(array($tempclass,$request_a));
        }
    }else{
        exit("$request_c is not find..");
    }
}

?>
